<script type="text/javascript">
	$('#image_button').click(function() {
		$('#toolbar_left').removeClass('pos-right');
		$('#toolbar_left').addClass('pos-left');
		$('#toolbar_image_upload').removeClass('no-display');
	});
	$('#select_img').click(function() {
		getStockImages();
		$('#img_selection').removeClass('not-visible');
	});
	$('#newImageUploadButton').click(function() {
		if ($('#content_image').val() == '') {
			alert(unescape('Zuerst bitte nach einem Bild auf deiner Festplatte suchen!'));
			return false;
		}
	});
	function selectImage(image) {
		hrcimage('textfield', escape('<{$HOME_URL}>images/content/'+image));
		$('#img_selection').addClass('not-visible');
	}
	function closeImageWindow() {
		$('#img_selection').addClass('not-visible');
	}
	function getStockImages() {
		$('#stockImages').load('<{$HOME_URL}>update.php?action=getStockImages');
	}
	$(document).ready(function() {
		//upload-funktion von hier: http://malsup.com/jquery/form/
		$('#content_image_upload_form').ajaxForm({
			beforeSubmit: function(a,f,o) {
				closeImageWindow();
				o.dataType = 'html';
				$('#uploadOutputContentImage').css('font-size', '8pt');
				$('#uploadOutputContentImage').css('position', 'relative');
				$('#uploadOutputContentImage').css('bottom', '5px');
				$('#uploadOutputContentImage').html('Bild wird hochgeladen...');
			},
			success: function(data) {
				$('#content_image').val('');
				var out = $('#uploadOutputContentImage');
				out.html('');
				alert(unescape(data));
				getStockImages();
				$('#img_selection').removeClass('not-visible');
			}
		});
	});
</script>
<div class="updateWrapper">
	<form method="post" id="update_form" name="update_form" action="#" onsubmit="update_txt('<{$viewPart}>', 'textfield'); return false;">
	<div class="topWindow" id="topWindow">
		<div class="left white">
			Text bearbeiten
		</div>
		<div class="right">
			<a href="javascript:closeUpdateWindow('<{$viewPart}>');" class="white bold">
				<img src="<{$HOME_URL}>images/close.gif" alt="Fenster schliessen" title="Fenster schliessen" class="closebutton" />
			</a>
		</div>
	</div>
	<div class="middleWindow" id="middleWindow">
		<textarea rows="15" id="textfield" name="textfield"><{$text}></textarea>
		<br />
		<div class="toolbar">
			<span id="uploadOutputContentImage"></span>
			<img class="button" src="<{$HOME_URL}>images/editor/button_hr.gif" onclick="hrcdivide('textfield');" title="Trennlinie" />
			<img class="button" src="<{$HOME_URL}>images/editor/button_bold.gif" onclick="hrcfett('textfield');" title="Fett" />
			<img class="button" src="<{$HOME_URL}>images/editor/button_italic.gif" onclick="hrckursiv('textfield');" title="Kursiv" />
			<img class="button" src="<{$HOME_URL}>images/editor/button_underline.gif" onclick="hrcul('textfield');" title="Unterstrichen" />
			<img class="button" src="<{$HOME_URL}>images/editor/button_center.gif" onclick="hrccen('textfield');" title="Zentriert" />
			<img src="<{$HOME_URL}>images/editor/toolbar_separator.gif">
			<img class="button" src="<{$HOME_URL}>images/editor/button_image.gif" id="image_button" title="Bild einf&uuml;gen" />
			<img class="button" src="<{$HOME_URL}>images/editor/button_link.gif" onclick="hrclink('textfield');" title="Hyperlink einf&uuml;gen" />
			<img class="button" src="<{$HOME_URL}>images/editor/button_mail.gif" onclick="hrcemail('textfield');" title="E-Mail Link einf&uuml;gen" />
		</div>
	</div>
	<input type="submit" value="Speichern" class="right small-font" />
	</form>
	<form method="post" id="content_image_upload_form" enctype="multipart/form-data" action="<{$HOME_URL}>update.php?action=content_image">
	<div class="bottomWindow" id="bottomWindow">
		<div id="toolbar_image_upload" class="no-display left">
			<input type="file"  name="content_image" id="content_image" class="small-font left" size="1" />
			<input type="submit" value="Neues Bild hochladen" class="small-font left" id="newImageUploadButton" />
			<div class="left">
				<div class="not-visible" id="img_selection">
					<span class="left" style="margin-bottom:10px;">Hier bitte ein Bild ausw&auml;hlen!</span>
					<div class="right">
						<a href="javascript:closeImageWindow();" class="white bold">
							<img src="<{$HOME_URL}>images/close.gif" alt="Fenster schliessen" title="Fenster schliessen" class="closebutton" />
						</a>
					</div>
					<div id="stockImages"></div>
				</div>
				<input type="button" id="select_img" value="Bild aus Bestand w&auml;hlen" class="small-font" />
			</div>
			<input type="button" value="Bild von Adresse angeben" class="small-font left" onclick="hrcimage('textfield');" />
		</div>
	</div>
	</form>
</div>